camera_apply


Description

This function will apply the given camera settings to the current camera view being rendered immediately. While you can set any view camera using the specific camera_set_* functions, the new settings will not be used for rendering until the next game frame, but with this function you can make those changes immediately. If you are using multiple views then the function should be used in the Draw Event and you can use the variable view_current to selectively apply the given camera only to the camera view currently being rendered. Note that this does NOT change the camera ID value, only the settings for that camera, and that if you use this function on the default camera (ie: the internal camera GameMaker Studio 2 uses when no view cameras are active) the changes will be overwritten the very next game frame by the internal settings for drawing the room.


Syntax:

camera_apply(camera_id)

Argument Description
camera_id The unique camera ID value returned when you created the camera.


Returns:

N/A


Example:

if view_current == 0
    {
    camera_apply(cutscene_cam);
    }

The above code (in a Draw Event) checks to see which camera view is currently being rendered and if it is camera view[0] then the settings for the camera referenced by the variable "cutscene_cam" are applied to it.